﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Tools;

namespace Pixysoft.Weblications.Sango.Battle
{
    class RveStageTeam
    {
        /// <summary>
        /// 房间编码
        /// </summary>
        long roomcode;
        /// <summary>
        /// 关卡编码
        /// </summary>
        Entities.War_Stage stage;
        /// <summary>
        /// 地区编码
        /// </summary>
        Entities.Sys_Section section;
        /// <summary>
        /// 开战时间
        /// </summary>
        long battledate;

        /// <summary>
        /// 创建人编码
        /// </summary>
        Entities.Usr_Profile creator;
        /// <summary>
        /// 参展人员列表
        /// </summary>
        List<string> profiles = new List<string>();


        public RveStageTeam(Entities.War_Stage stage, Entities.Sys_Section section, Entities.Usr_Profile profile, long battledate)
        {
            this.roomcode = GlobalTimer.Instance.ToTimeSequence();
            this.stage = stage;
            this.section = section;
            this.creator = profile;
            this.battledate = battledate;

            profiles.Add(profile.Usercode);
        }

        /// <summary>
        /// 加入队伍
        /// </summary>
        /// <param name="usercode"></param>
        public void Join(string usercode)
        {
            if (profiles.Contains(usercode))
                return;

            profiles.Add(usercode);
        }

        /// <summary>
        /// 离开队伍
        /// </summary>
        /// <param name="usercode"></param>
        public void Leave(string usercode)
        {
            if (!profiles.Contains(usercode))
                return;

            profiles.Remove(usercode);
        }

        /// <summary>
        /// 获取队员列表
        /// </summary>
        public string[] Profiles
        {
            get
            {
                return profiles.ToArray();
            }
        }

        public void Dispose()
        {
            this.stage = null;
            this.section = null;
            this.creator = null;
            this.profiles.Clear();
        }

        public long Roomcode
        {
            get
            {
                return roomcode;
            }
        }

        public Entities.War_Stage Stage
        {
            get
            {
                return stage;
            }
        }

        public Entities.Sys_Section Section
        {
            get
            {
                return section;
            }
        }

        public long Battledate
        {
            get
            {
                return battledate;
            }
        }

        public Entities.Usr_Profile Creator
        {
            get
            {
                return creator;
            }
        }


    }
}
